<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/md5.js"></script>
    <title>Register: Personal info</title>
    <style>
        @import url(/css/LoginStyle.css);
        body{text-align: center;}
        .text{
            margin-top:20px;
            padding-left:20px;
            font-family: QS-R;
        }

        .btn{
            margin-top:20px;
        }

        .button:hover{
            cursor: pointer;
        }
        .forget {
            margin-top:10px;
        }
        .forget span:hover {
            cursor: pointer;
            color:#76839b;
        }
        .sign-up {
            margin-top:10px;
        }

        .sign-up .clickable:hover {
            cursor: pointer;
            color:#76839b;
        }

        .forget span{
            text-align:left;
            padding-right:220px;
        }

        .sign-up .clickable{
            text-align:left;
            padding-right:130px;
        }

        .font-QS-R {
            font-family: QS-R;
            /*color: #0066FF;*/
        }

        .text::-webkit-input-placeholder{
            padding-left:50px;
            font-family: QS-R;
        }
        .inner-window {
            width: 500px;
            margin: 0 auto;
            float: left;
        }

        .outer-window {
            width: 500px;
            margin: 0 auto;
            overflow:hidden;


        }
        .outer-window .container {
            position:relative;
        }

        .clearfix:after {

            content: "";
            display: block;
            font-size: 0;
            clear: both;
            visibility: hidden;

        }
        .select-role h1{
            text-align: center;
        }
        .select-role h2{
            font-family: QS-M;
            font-size:20px;
        }
        .button1{
            background-color: rgba(157,157,157,.15);
            font-size: 30px;
            border: none;
            border-radius: 8px;
            width: 225px;
            height: 70px;
            font-family: QS-M;
        }
    </style>
</head>
<body style="width:100%">

<div class="outer-window">
    <div class="container clearfix" style="width:2000px">
        <div class="login inner-window">
            <div align="center">
                <img src="/image/LOGO.png" style="width:222px;height:114px;">
            </div>
            <h1>Clean Password</h1>

            <div style="position: absolute;display: none" class="change-psw-bar">
                <input type="password" id="username" name="password" class="input text" placeholder="Set your password">
                <input type="password" id="password" name="password" class="input text" placeholder="Set your password">
                <input onclick="cloeseBar()" type="button" id="select-uni-next" class="button next" Value="submit">
            </div>

            <div>
                <input type="text" id="login-username" name="login-username" class="input text" placeholder="User Name"><br/>
                <div id="err-msg" style="color: red;display: none"></div>

            </div>

            <div class="btn" style="margin-left:150px">
                <input type="button" onclick="document.location='/login'" class="button back" Value="Back">
                <input type="button" onclick="document.location='/login'" id="change" class="button" Value="Clean!">
            </div>

        </div>
    </div>
    <script>
        $("#change").click(function () {
            let username = document.getElementById("username").value;
            let password = hex_md5(document.getElementById("password").value);


            $.ajax({
                url:"/changePSW",
                dataType: "JSON",
                method: "POST",
                data:{
                    username :document.getElementById("username").value,
                    password:hex_md5(document.getElementById("password").value)
                },
                success:function (data) {
                    if (data.code===true){
                        alert("success!")
                    }
                }

            })
            alert("clean your password! now you just need to login without code! ");
        })
    </script>
</div>

</body>

</html>